#include<stdio.h>

int main(void)
{
	int choose,dig[4];
	char num[4];
	scanf("%1d %c%c%c%c",&choose,&num[0],&num[1],&num[2],&num[3]);
	for(int i=0;i<4;i++)
	{
		if(num[i]>='a'&&num[i]<='z')
		{
			dig[i]=(int)num[i]-96;
		}
		else
		{
			dig[i]=(int)num[i]-64;
		}
	}
	switch(choose)
	{
		case 1:printf("%d %d %d %d",dig[0],dig[1],dig[2],dig[3]);break;
		case 2:printf("%d %d %d %d",dig[3],dig[2],dig[1],dig[0]);break;
		case 3:printf("%d %d %d %d",dig[2],dig[3],dig[0],dig[1]);break;
		case 4:printf("%d %d %d %d",dig[1],dig[0],dig[3],dig[2]);
	}
	
	return 0;
}
